package at.donalfonso.model;

import java.io.Serializable;

public class Pizza implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -1092998815604327105L;

	public enum PizzaEnum{
		MARGARITA (5, 3),
		SALAMI(5.5, 7),
		CARDINALE(6, 5);
	
		private final double preis;
		private final int time;
	
		PizzaEnum(double preis, int time){
			this.preis = preis;
			this.time = time;
		}
			
		public double getPreis(){
			return preis;
		}
		
		public int getTime(){
			return time;
		}
	}
	
	public enum PizzaStatusEnum {
		BESTELLT,
		ZUBEREITUNG,
		FERTIG;
	}

	private String bestellNummer = ""; 
	private String id = "";
	private static int uid = 2000;
	private PizzaEnum type;
	private PizzaStatusEnum status = PizzaStatusEnum.BESTELLT;
	private String koch = "";
	
	public Pizza(PizzaEnum type){
		this.type = type;
//		id = "P" + getNextid();
	}
	
	public Pizza(PizzaEnum type, String id) {
		this.type = type;
		this.id = id;
	}
	
	public String getBestellnummer(){
		return bestellNummer;
	}
	
	public void setBestellnummer (String bestellNummer){
		this.bestellNummer = bestellNummer;
	}

	public String getId() {
		return id;
	}
	
	public PizzaEnum getType(){
		return type;
	}
		
	public static int getNextid(){
		return ++uid;
	}
	
	public PizzaStatusEnum getStatus() {
		return status;
	}
	
	public void setStatus(PizzaStatusEnum status) {
		this.status = status;
	}

	public String getKoch() {
		return koch;
	}
	
	public void setKoch(String name) {
		koch = name;
	}
	
	@Override
	public String toString() {
		return " (" + getId() + ": " + getType() + " " + getStatus() + " " + getKoch() + ")";
	}

	/**
	 * Überschrieben wegen Bestellung
	 * gleiche Id bedeutet gleiche Pizza
	 */
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if ((o == null) || (o.getClass() != this.getClass()))
			return false;
		Pizza p = (Pizza) o;
		return (getId().equals(p.getId()));
	}
}
